import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:study_demo/ui/read_pdf/controller.dart';

class ReadPdfPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetX<ReadPdfController>(
        init: ReadPdfController(),
        builder: (controller) {
          return Scaffold(
            appBar: AppBar(
              title: Text("查看PDF"),
              actions: <Widget>[
                TextButton(onPressed: (){
               controller.openDirectory();
              }, child: Text('本地文件',style: TextStyle(color: Colors.white)))],
            ),
            body: Stack(
              children: <Widget>[
//              PDFView(
//                filePath: controller.pathPDF.value,
//                enableSwipe: true,
//                swipeHorizontal: true,
//                autoSpacing: false,
//                pageFling: true,
//                pageSnap: true,
//                defaultPage: 0,
//                fitPolicy: FitPolicy.BOTH,
//                preventLinkNavigation:
//                    false,
//                onRender: (_pages) {
//
//                },
//                onError: (error) {
//                  print(error.toString());
//                },
//                onPageError: (page, error) {
//                  print('$page: ${error.toString()}');
//                },
//                onViewCreated: (PDFViewController pdfViewController) {
//                  controller.pdfController.complete(pdfViewController);
//                },
//                onPageChanged: (int page, int total) {
//                  print('page change: $page/$total');
//                },// if set to true the link is handled in flutter
//              ),
          ]));
        });
  }
}
